<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
        <script>
           /* var arr1=[1,2];
            // push和pop
            arr1.push('我是push进来的哦'); //输出 [1, 2, "我是push进来的哦"]
            console.log(arr1);
            arr1.pop();
            console.log(arr1); //输出 [1,2]
            console.log('===================================');

            // unshift和shift
            console.log(arr1);
            arr1.unshift('我是unshift进来的','我也是unshift进来的')
            console.log(arr1);
            arr1.shift();
            console.log(arr1);
            
            console.log('===================================');

            var arr2=[3,1,2]
            arr2.sort();
            console.log(arr2);

            var arr3=[6,2,3,4]
            arr3.reverse();
            console.log(arr3); */

            var arr1=[5,9,3,4,1,7]
            arr1.sort();
            
         arr1.PX=function(arr){
             arr.sort();
             console.log(arr1);
         }
         arr1.PX(arr1);



            /* arr1.paiXu=function(fn){
                if(fn===undefined){
                    fn=(a,b)=>a>b;
                }

                for(var j=0;j<=arr1.length;j++)
                {
                    var min=this[j]; //把遍历的最小值进行赋值
                    var minIndex=j;
                    console.log(min);
                     for(var i=i+j;this.length;j++)
                     {
                            if(fn(min,this[i])){
                                min=this[i];
                                minIndex=i;
                            }
                     }

                     var a = this[j]
                     this[j] = this[minIndex]
                     this[minIndex] = a   
                }

            }
            arr1.paiXu(); */
        </script>
</body>
</html>